<template>
  <el-dialog title="设置计划" :visible.sync="dialogVisible" width="800px">
    <div>
      <Crontab @fill="getValue" @hide="dialogVisible = false" />
    </div>
  </el-dialog>
</template>
<script>
export default {
  components: {
    Crontab: () => import('@/components/crontab/index.vue'),
  },
  data() {
    return {
      dialogVisible: false,
      form: {
        id: '',
        cron: '',
      },
    }
  },
  mounted() {
    this.$bus.$on('setCollectCron', (row) => {
      this.form.id = row.id
      this.dialogVisible = true
    })
  },
  methods: {
    async getValue(v) {
      this.form.cron = v
      await this.$store.dispatch('addPlanTestPaper', this.form)
      this.$parent.getList()
    },
  },
}
</script>